//导入 createSlice 
import { configureStore } from '@reduxjs/toolkit';

//导入 reducer
import reducer from './slice';

// 开始写创建store对象。
let store = configureStore({ reducer })

// 暴露 store
export default store; 


// 从 store 本身推断出 `RootState` 和 `AppDispatch` 类型
export type RootState = ReturnType<typeof store.getState>
// 推断出类型: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch